<?php
/**
 * @return
 * @author 朱乐斌
 * @date
 */

namespace app\api\validate;

use think\Validate;

class WorkValidate extends Validate
{
    // 验证规则
    protected $rule = [
        'name' => 'require|max:30|regex:/^[\x{4e00}-\x{9fa5}]+$/u',
        'position' => 'require|max:20|regex:/^[\x{4e00}-\x{9fa5}]+$/u',
        'content' => 'require|max:255|regex:/^[\x{4e00}-\x{9fa5}]+$/u'
    ];
    // 提示信息
    protected $message = [
        'name.require' => "公司名不能为空",
        'name.max' => "公司名最多30字符",
        'position.require' => "职位不能为空",
        'position.max' => "职位最多20字符",
        'content.require' => "详细内容不能为空",
        'content.max' => "详细内容不能超过255字符",
        'name.regex' => "请输入中文名称",
        'position.regex' => "请输入中文职位",
        'content.regex' => "请输入中文详细内容"
    ];

    // 验证场景
    protected $scene = [
        'addWork' => ['name', 'position', 'content']
    ];

}